package com.jandan.web.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.web.util.WebUtils;

import com.jandan.web.front.UserSession;

public class AdminLoginController extends AbstractController {

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		AdminSession adminSession = (AdminSession) WebUtils.getSessionAttribute(request, "adminSession");
		if(adminSession != null){
			ModelAndView model = new ModelAndView(new RedirectView("main.htm"));
			return model;
		}
		return new ModelAndView("admin_login");
	}
}
